Installation of routing tables for logical router in route server mode

ABSTRACT

Some embodiments provide a method for a network controller operating on a host machine that hosts a particular one of multiple centralized routing components for a logical router. The method receives a routing table from a routing protocol application operating on the host machine. Each of the other centralized routing components operates on a different host machine and implements a different interface of the logical router that connects to at least one physical router external to the logical network. The routing protocol application operates as a router server for all of the centralized routing components. For each of the other centralized routing components, the method identifies a set of routes in the routing table to distribute to the centralized routing component. The method sends the identified routes for each centralized routing component to the centralized routing component.

BACKGROUND

Typical physical networks contain several physical routers to perform L3 forwarding (i.e., routing). When a first machine wants to send a packet to a second machine located on a different IP subnet, the packet is sent to a router that uses a destination IP address of the packet to determine through which of its physical interfaces the packet should be sent. Larger networks will contain multiple routers, such that if one of the routers fails, the packets can be routed along a different path between the first machine and the second machine. Both within a contained network and across network boundaries, routing protocols are used to advertise routes through the network. That is, a first router peers with a second router and sends messages to the second router indicating which addresses it can reach through its other interfaces and how far away those addresses are. The first router also receives corresponding information from the second router, and uses this information to determine how to route packets.

In logical networks implemented in a datacenter, user-defined data compute nodes (e.g., virtual machines) on different subnets may need to communicate with each other, as well as with machines external to the datacenter. In this case, tenants may define a network for virtualization that includes both logical switches and logical routers. Methods for implementing the logical routers to adequately serve such virtualized logical networks in datacenters are needed, including methods that allow for a similar route exchange with routers of the external physical network.

BRIEF SUMMARY

Some embodiments provide a method for implementing one or more dynamic routing protocols (e.g., BGP, OSPF, etc.) for a logical router that interfaces with an external network (e.g., external to the datacenter in which the logical router is implemented). In some embodiments, the logical router has multiple interfaces with the external network, which are implemented by multiple centralized routing components operating in separate gateway host machines (the logical router may also have a distributed routing component, implemented on all of the gateway host machines as well as other host machines). Each interface may be assigned to a separate centralized routing component in some embodiments, while other embodiments allow multiple interfaces per centralized routing component. Each of the interfaces connects to at least one external subnet in some embodiments, and the centralized routing components are each physically connected to at least one external physical router in the external subnet.

In some embodiments, each of the gateway host machines includes the centralized routing component, a local controller, and a routing protocol application. In some embodiments, the centralized routing component is implemented as a separate data compute node (e.g., virtual machine, container, etc.), in which case the gateway host machine also includes a managed forwarding element that performs additional logical processing on packets sent to and from the centralized routing component. In other embodiments, the centralized routing component is implemented within the datapath of the MFE (e.g., in a datapath development kit (DPDK) based MFE).

Though referred to herein as an application, the routing protocol application may be an application, a daemon operating in the background, a kernel layer process, etc. in different embodiments. While each of the gateway host machines includes a routing protocol application, in some such embodiments only one of these is designated as an active routing protocol application, which implements the dynamic routing protocols for all of the centralized routing components of the logical router. The other routing protocol applications act as standbys, in case the active routing protocol application fails. When external physical routers send routing protocol packets to these standby routing protocol applications, the datapaths on their gateway host machines forward the packets to the correct gateway host machine (with the master routing protocol application).

The local controller on each of the host machines communicates with a centralized network controller to receive configuration information for configuring (i) the MFE on the host machine, (ii) the centralized routing component (which, as mentioned, may be implemented within the datapath of the MFE), and (iii) the routing protocol application. The local controller of some embodiments translates this data into formats readable by these components and uses the translated data to configure the components.

In addition, the local controller on the host machine with the master routing protocol application is responsible for distributing a routing table (e.g., forwarding information base, or FIB) calculated by the routing protocol application based on the routing protocol packets received from the external physical routers. When the different centralized routing components connect to different external subnets, only some of the routes may be useful for them. Thus, the local controller stores information indicating the subnets to which each of the other centralized routing components connects. For each route in the routing table from the master routing protocol application, the local controller identifies the centralized routing components that connect to the subnet to which the next hop of the route corresponds, and only distributes the route to the local controller managing that centralized routing component.

The preceding Summary is intended to serve as a brief introduction to some embodiments of the invention. It is not meant to be an introduction or overview of all inventive subject matter disclosed in this document. The Detailed Description that follows and the Drawings that are referred to in the Detailed Description will further describe the embodiments described in the Summary as well as other embodiments. Accordingly, to understand all the embodiments described by this document, a full review of the Summary, Detailed Description and the Drawings is needed. Moreover, the claimed subject matters are not to be limited by the illustrative details in the Summary, Detailed Description and the Drawing, but rather are to be defined by the appended claims, because the claimed subject matters can be embodied in other specific forms without departing from the spirit of the subject matters.

BRIEF DESCRIPTION OF THE DRAWINGS

The novel features of the invention are set forth in the appended claims. However, for purpose of explanation, several embodiments of the invention are set forth in the following figures.

FIG. 1 conceptually illustrates a logical view of a logical network, which includes multiple routing components for a logical router.

FIG. 2 illustrates a physical implementation of the logical network of FIG. 1, specifically focusing on the logical router.

FIG. 3 conceptually illustrates the architecture of a gateway host machine of some embodiments on which a routing protocol application operates.

FIG. 4 conceptually illustrates a process of some embodiments for processing routing protocol packets in the MFE datapath.

FIG. 5 conceptually illustrates a process of some embodiments for installing routes calculated by a routing protocol application for use by the SRs, when the installation is performed by a local network controller operating at the gateway host with the master routing protocol application.

FIG. 6 conceptually illustrates three SRs of a logical router and their connections to external routers.

FIG. 7 conceptually illustrates the individualization of routing tables for the SRs of FIG. 6 by a local controller.

FIG. 8 conceptually illustrates a process of some embodiments for installing routes calculated by a routing protocol application for use by the SRs, when the installation is performed separately by each local network controller for the SR operating on its gateway host.

FIG. 9 conceptually illustrates the individualization of routing tables for the SRs of FIG. 6 by three separate local controllers.

FIG. 10 conceptually illustrates an electronic system with which some embodiments of the invention are implemented.

DETAILED DESCRIPTION

Some embodiments provide a method for implementing one or more dynamic routing protocols (e.g., BGP, OSPF, etc.) for a logical router that interfaces with an external network (e.g., external to the datacenter in which the logical router is implemented). In some embodiments, the logical router has multiple interfaces with the external network, which are implemented by multiple centralized routing components operating in separate gateway host machines (the logical router may also have a distributed routing component, implemented on all of the gateway host machines as well as other host machines). Each interface may be assigned to a separate centralized routing component in some embodiments, while other embodiments allow multiple interfaces per centralized routing component. Each of the interfaces connects to at least one external subnet in some embodiments, and the centralized routing components are each physically connected to at least one external physical router in the external subnet.

FIG. 1 conceptually illustrates a logical view 100 of a logical network 100, which includes multiple routing components for a logical router 150. As shown, the logical network 100 includes this logical router 150 as well as two logical switches 155 and 160. Each of the logical switches 155 and 160 have logical ports to which data compute nodes (DCNs) attach. These DCNs may be virtual machines (VMs), containers, physical machines, etc.

In some embodiments, when a user configures the logical network, the user inputs a logical router and assigns one or more interfaces to the logical router. The management plane then defines multiple logical routing components for the logical router, if need be, as well as a transit logical switch to connect them. As shown in FIG. 1, the network controller has created three centralized routing components, also referred to as service routers (SRs), 105-115 for the logical router 150, as well as a distributed router (DR) 120 and a transit logical switch 125. The DR 120 includes a southbound interface for each of the logical switches 155 and 160, and a single northbound interface to the transit logical switch 125 (and through this to the SRs). The SRs 105-115 each include a single southbound interface to the transit logical switch 120 (used to communicate with the DR 120, as well as each other in certain situations). Each SR 105-115 also corresponds to one or more uplink interfaces of the logical router, which connects to a network external to the logical network. In this case, each of the SRs 105-115 is assigned a single interface, which may be on the same or different external subnets, and thus connect to either the same set of external routers or different sets of routers, in different circumstances. In this case, the interface assigned to the first SR 105 is on a first subnet 10.1.1.0/24 and connects to a first external router 130, while the second and third interfaces assigned to SRs 110 and 115 are on a second subnet 20.1.1.0/24 and both connect to a second external router 135.

The detailed configuration of the northbound and southbound interfaces of the various routing components 105-120 and their connections with the transit logical switch 125 are described in detail in U.S. patent application Ser. No. 14/871,968, which is incorporated herein by reference. In some embodiments, the management plane generates separate routing information bases (RIBs) for each of the router constructs 105-120. That is, in addition to having separate objects created in the management/control plane, each of the router constructs 105-120 is treated as a separate router with a separate routing table. Some embodiments define a subnet for the transit logical switch from a pool of available subnets for internal use, and define the internal interfaces of the router constructs 105-120 as having IP addresses in that subnet. In addition, the management plane assigns MAC addresses to each of the internal interfaces. The RIB for the DR 120 of some embodiments is defined with a default route pointing to any of the three southbound interfaces of the SRs 105-115 (which the implementation would choose among using equal-cost multi-path (ECMP) principles). In addition, the user would typically configure a static default route for the logical router pointing to the external routers 130 and 135, which would be automatically added to the RIBs for each of the three SRs 105-115.

FIG. 2 illustrates a physical implementation 200 of the logical network 100, specifically focusing on the logical router 150. As shown, the DCNs of the logical network operate on one or more host machines 205, on which managed forwarding elements 210 operate. The DCNs may all operate on the same host machine or be distributed across multiple such host machines.

Managed forwarding elements (MFEs) 210 also operate on these host machines 205, in order to implement the distributed aspects of the logical network 100. These MFEs 210, in some embodiments, are software virtual switches (e.g., Open vSwitch (OVS), ESX) that operate within the hypervisors or other virtualization software on the host machines. Though the MFEs are software virtual switches, they may be referred to as physical forwarding elements in order to differentiate them from the logical forwarding elements 150-160, which are abstract elements defined as a network configuration, and which are implemented on the physical forwarding elements. These MFEs 210 perform first-hop switching and routing on packets sent by the DCNs to implement the logical switches 155 and 160 and the DR 120. The MFEs 210 (or a subset of them) also may implement logical switches (and distributed logical routers) for other logical networks if the other logical networks have DCNs that reside on the host machines 205 as well.

The three SRs 105-115 each operate on different gateway machines 215-225. The gateway machines 215-225 are host machines similar to the machines 205 in some embodiments (e.g., x86 boxes), but host SRs rather than user DCNs. In some embodiments, the gateway machines 215-225 operate MFEs similar to the MFEs 210. In some such embodiments, the SR operates as a separate data compute node (e.g., in a VM, namespace, etc.), to which the MFE on the gateway machine sends packets (and from which the MFE receives packets after processing). In other embodiments, however, the SR is implemented within the MFE datapath (e.g., in a datapath development kit (DPDK) based MFE), as shown in this case. Specifically, the datapath 230 of the MFE on the first gateway host 215 is configured to implement the first SR 105, the datapath 235 of the MFE on the second gateway host 220 is configured to implement the second SR 110, and the datapath 240 of the MFE on the third gateway host 225 is configured to implement the third SR 125.

The MFEs on the gateways 215-225, like the MFEs 210 on the user DCN hosts, implement the distributed aspects of the logical network 100, including the logical switches 155 and 160, the DR 120, and transit logical switch 125. For instance, packets sent from the external network may be routed by the SR routing table on one of the gateway machines and then subsequently switched and routed (according to the DR routing table) by the MFE on the same gateway. In addition, the MFE provides the connections to the physical NICs on the gateway machines 215-225, for both internal connections (e.g., tunneling to other MFEs) as well as connections to external routers, as shown in more detail below by reference to FIG. 3. Each of the MFEs on the gateway machines 215-225 connects to one of the external routers 130 (in the case of the gateway machine 215) and 135 (in the case of the gateway machines 220 and 225). For differentiation purposes in this figure, tunnels between the edge MFEs 210 (that connect directly to the user DCNs) and gateway MFEs (that implement the SRs) are shown as straight dotted lines, while tunnels between the gateway MFEs are shown as orthogonal solid lines. In addition, the connections from the gateway MFEs to the external routers 130 and 135 are shown as straight dashed/dotted lines.

As shown, each of the gateway host machines 215-225 also operates a routing protocol application 245-255. Though referred to herein as an application, the routing protocol applications 245-255 may be applications, daemons operating in the background, kernel layer processes, etc. in different embodiments. In some embodiments only one of the routing protocol applications is designated as an active routing protocol application (in this case, the second application 250, corresponding to the second SR). The active routing protocol application 250 implements the dynamic routing protocols (e.g., BGP, OSPF, etc.) for all of the centralized routing components of the logical router. The other routing protocol applications 245 and 255 act as standbys, in case the active routing protocol application fails. When external physical routers send routing protocol packets to these standby routing protocol applications, the datapaths on their gateway host machines forward the packets to the correct gateway host machine (with the master routing protocol application). In some embodiments, local controllers operating on the gateway hosts use various deterministic criteria (so that they will all come to the same conclusion) to select one of the routing protocol applications 245-255 as the active application. For instance, in some embodiments the administrator that configures the logical network ranks the SRs, and this ranking is used to select an active routing protocol application. Other embodiments use other selection techniques (e.g., a deterministic hash algorithm, etc.).

The active routing protocol application 250 operates one or more control planes for routing protocols such as Border Gateway Protocol (BGP), Open Shortest Path First (OSPF), or others. As with the datapaths 230-240 implementing SRs (and other logical forwarding elements) for multiple logical networks, the routing protocol applications may operate the routing protocol control planes for multiple logical routers of multiple logical networks in some embodiments. For instance, the routing protocol applications 245 and 255, which are inactive (standby) with respect to the logical router 150, might be actively operating routing protocol control planes for other logical routers. In other embodiments, separate routing protocol application instances are instantiated on the gateways for other logical routers (e.g., each instance of the application, daemon, process, etc. operates a control plane for one logical router).

The active routing protocol application of some embodiments receives (i) routing protocol data from the external router(s) to which its local SR connects and (ii) routing protocol data from the other SRs that those SRs have received from their external router connections. The northbound ports of the two external routers 130 and 135 might be connected to different subnets, and have completely different sets of routes (or similar routes, depending on the configuration). In addition, the active application generates routing protocol packets (e.g., to advertise routes for public IP addresses and subnets of the logical network) and sends these packets to the external router(s) to which its local SR connects. For example, the SRs 105-115 might advertise the subnets of logical switch 155 and/or logical switch 160, depending on whether these addresses are public.

In some embodiments, the active application also generates routing protocol packets for the other SRs, which are tunneled to these other SRs and sent out by them to their respective connected external routers. In other embodiments, each routing protocol application (including the inactive applications) generates its own routing protocol packets for advertising routes, but still forwards received packets to the single active application acting as the route server.

In the example shown in FIGS. 1 and 2, the logical router that connects to the external network also connects directly to the logical switches. In some embodiments, two tiers of logical routers are defined within a logical network. Provider logical routers (PLRs) provide a connection between the logical network implemented in a datacenter and the external network, and are often administered by the owner of the datacenter. Multiple tenant logical routers (TLRs) may connect to the southbound interfaces of PLRs, allowing different tenants of a datacenter to configure their own logical routers (and logical switches). In the two-tiered case of some embodiments, the PLRs implement the routing protocols in the manner described herein, in order to exchange routes with the external network. In some such cases, the logical switches that connect to the TLRs may be public subnets, and the PLR advertises routes for these logical switch subnets. The two tiers of logical routers are described in further detail in U.S. Patent Publication 2015/0271303, which is incorporated by reference herein.

In some embodiments, local network controllers operate on each of the gateway host machines, for the purpose of communicating with a centralized network controller to receive configuration information for configuring (i) the MFE on the host machine, (ii) the centralized routing component (which, as mentioned, may be implemented within the datapath of the MFE), and (iii) the routing protocol application. The local controller of some embodiments translates this data into formats readable by these components and uses the translated data to configure the components.

FIG. 3 conceptually illustrates the architecture of a gateway host machine 300 of some embodiments on which a routing protocol application operates. Specifically, the gateway host machine includes a local controller 305, a MFE 310, and a routing protocol application 315. The host machine 300 also includes two physical network interface controllers (PNICs) 320 and 325, though some hosts may have fewer (i.e., one) or more (e.g., if the SRs implemented on the host machine connect to different external subnets).

As mentioned, the local controller 305 receives configuration information for both the MFE 310 and the routing protocol application 315. In some embodiments, this configuration information is received from a set of central network controllers (not shown) as a set of abstract data tuples, and converted into data formatted for the MFE 315 and routing protocol application 315. For instance, when an administrator configures a logical network, the management plane of some embodiments generates data tuples describing the logical network (e.g., the logical forwarding elements, logical ports of those forwarding elements, etc.), and a central controller (or cluster of central controllers) passes these generated data tuples to the appropriate local controllers (those operating on host machines that require the configuration).

In this case, the local controller 305 provides datapath configuration data 330 to the MFE 310, enabling the MFE to implement the logical forwarding elements of one or more logical networks, including an SR of a logical router. This datapath configuration data 330 may be provided in the form of flow entries for a flow-based MFE (e.g., OVS), configuration rules, etc. In some embodiments, the MFE 310 is a DPDK-based datapath that operates in the userspace of a hypervisor in the host machine 300. The local controller also provides routing configuration data 335 to the routing protocol application 315. This configuration data 335, in some embodiments, includes the routes to advertise, the SRs for which the application 315 advertises routes, etc.

In some embodiments, as mentioned, the MFE 310 is a DPDK-based datapath that includes configuration for the SR. The datapath operates to process a packet by retrieving rules for logical forwarding elements (e.g., the logical switches, DR, and SR) from a configuration rules database, and matching the packet against these rules. The configuration rules matched by a packet for a particular logical forwarding element may specify to drop the packet, logically send the packet to a logical port of another logical forwarding element (in which case the rules for that logical forwarding element are retrieved from the configuration database), modify the packet (e.g., by encapsulating the packet in a tunnel, routing the packet, etc.), output the packet to one or the other of PNICs 320 and 325, etc.

As shown, the MFE 310 receives packets from and sends packets to the PNICs 320 and 325. The first PNIC 320 allows the MFE to exchange traffic 340 with an external router 345. These packets may include data traffic sent between the DCNs of the logical network located behind the gateway and external machines. In addition, the external router 345 sends routing protocol packets (e.g., BGP and/or OSPF packets) to the routing protocol application 310 via this interface, and similarly such packets generated by the application 315 are sent to the external router 345 via the interface. The PNIC 325 allows the MFE 310 to exchange traffic 350 with other MFEs through tunnels between the MFEs. This traffic 350 may also include both data traffic (e.g., sending packets to and receiving packets from the user DCNs of the logical network) as well as routing protocol packets. For instance, if one of the SRs with a standby routing protocol application receives a routing protocol packet from an external router, that SR encapsulates the packet and sends it to the SR with the active routing protocol application. In some embodiments, the tunnel encapsulation includes context information indicating that it is a routing protocol packet, so that the MFE 310 can send the packet to the routing protocol application 315.

The routing protocol application 315, in some embodiments, is configured to act as a control plane for all of the SRs of a logical router (assuming it is the active application for that logical router). In some embodiments, the application includes multiple interfaces with the MFE 310, with each interface corresponding to a particular one of the SRs. In this case, there are three interfaces because the logical router in question includes three SRs (including the SR implemented by the MFE 310). The MFE 310 forwards the routing protocol packets 355 received from the external router 345 and via tunnels from the other SRs to the application 315 via the appropriate interface. In some embodiments, the MFE 310 and routing protocol application 315 both operate in userspace, but pass the routing protocol packets through the kernel. For instance, some embodiments use a userspace kernel transport, such as a kernel NIC interface (KNI), to transfer the packets between the two processes.

The routing protocol application 315 receives the routes via the routing protocol packets and performs routing protocol operations to calculate a routing table, or forwarding information base (i.e., a set of routes for the logical router). For example, a first external router might advertise to one of the SRs that it reaches a particular subnet with an administrative distance of X, while a second external router advertises to a different SR that it reaches the particular subnet with an administrative distance of 4X. In this case, the routing protocol application 315 identifies that the route with a distance X should be part of the routing table and discards the other route. The routing protocol application 315 provides these routes 360 to the local controller 305.

The local controller 305 is responsible for distributing the routing table calculated by the routing protocol application 315. However, when the different SRs connect to different external subnets, different subsets of the routes may be useful for each of the SRs. Thus, the local controller 305 stores information indicating the subnets to which each of the other SRs connect. For each route in the routing table from the master routing protocol application 315, the local controller 305 identifies the SRs that connect to the subnet to which the next hop of the route corresponds, and only distributes the route to the local controller managing that SR. These routes may be distributed via the central controller cluster in some embodiments, or directly through a connection between the local controllers in other embodiments.

As mentioned, in some embodiments each of the MFEs that implements an SR may receive routing protocol packets from the external routers to which its SR connects. FIG. 4 conceptually illustrates a process 400 of some embodiments for processing routing protocol packets in the MFE datapath. This process refers to the operation of a DPDK-based MFE datapath, but similar operations could be performed by a flow-based MFE, a code-based MFE such as an ESX hypervisor, etc.

As shown, the process begins by receiving (at 405) a routing protocol packet in the datapath. In some embodiments, the MFEs that implement SRs with connections to external routers are configured (e.g., by their respective local controllers) to perform initial processing to determine whether a packet is a routing protocol packet, so that it can be sent to the active routing protocol application with minimal or no additional processing. When standard data packets are received, the MFE of some embodiments performs the operations of various logical forwarding elements on these packets, which are not required (or desired) for routing protocol packets meant for consumption by the routing protocol application. Some embodiments identify, for example, BGP packets on TCP port 179, while OSPF unicast packets are identified as IP packets with a protocol value of 89. In addition, OSPF uses addresses 224.0.0.5 and 224.0.0.6 for multicast packets in some embodiments.

For packets received from an external router, some embodiments identify the packet as a routing protocol packet based on analysis of the header to identify the routing protocol (e.g., BGP, OSPF, etc.). However, packets that have been sent to a gateway with the master routing protocol application from a gateway with the standby application will be tunneled. As described below by reference to operation 415, some embodiments include context information in the tunnel header to identify the packet as a routing protocol packet.

Upon receiving a routing protocol packet, the process 400 determines (at 410) whether the master routing protocol application for the SR to which the packet is local (i.e., whether the master is located at the current gateway). In some embodiments, the routing protocol packet is sent to a particular IP address (the northbound interface of the SR), and this IP address enables the MFE to identify the logical router for which the packet is intended (if multiple SRs are implemented by the MFE). The MFE is also configured with the location of the active routing protocol application for the logical router, which could be local or on the gateway machine hosting a different SR.

When the master routing protocol application is not local, the process encapsulates (at 415) the packet in a tunnel to the location of the master routing protocol application. In some embodiments, this tunnel header includes context information indicating that the packet is a routing protocol packet. As noted above, some embodiments use overlay network tunnels (e.g., STT, GRE, etc.) to send logical network packets between MFEs. This encapsulation uses IP addresses assigned to the sending and receiving MFEs (e.g., of PNICs of their respective gateway hosts) to send packets through the datacenter. The tunnel header, in some embodiments, also allows for certain context information to be embedded (e.g., to indicate logical network processing results for data packets, etc.). Some embodiments use this context information to indicate that a packet should be sent to the routing protocol application. The process then sends (at 420) the packet to the physical interface of the gateway host machine that is used for internal tunnel traffic (e.g., the PNIC 325 of FIG. 3), and ends.

On the other hand, when the master routing protocol application is located locally on the gateway host machine with the SR performing process 300, the process identifies (at 325) the SR with which the packet is associated. The process then sends (at 330) the packet to the routing protocol application via a userspace-kernel transport associated with the identified SR, and ends. The SR can be identified based on the source of the packet, in some embodiments, as well as by the address to which the packet is sent. For instance, packets received directly from an external router at the gateway host machine will generally be associated with the local SR, and sent to the IP address used by the local (master) routing protocol application. Packets received through a tunnel are associated with the SR to which the packet was originally sent, which can be identified by the source address in the tunnel header (which identifies the gateway host machine) as well as the internal destination of the routing protocol packet itself.

As described above, in some embodiments the MFE passes routing protocol packets to the routing protocol application via userspace-kernel transports, such as KNIs or TUN/TAP virtual network kernel devices. The MFE datapath creates one KNI (or other transport mechanism) per SR, and forwards the routing protocol packets to the routing protocol application via the correct KNI based on SR to which the packet was originally sent. The user of multiple interfaces allows the routing protocol application to easily identify the SR to which the packet was originally sent, and for packets with multiple IP addresses to be sent to different interfaces.

The routing protocol application uses the routes advertised by the external routers via these routing protocol packets to calculate routes for all of the SRs. In some embodiments, the active routing protocol application does not need to operate with an understanding of the separation of the various SRs, and instead calculates the routes as though the logical router is a single router entity and provides these routes to the local controller. In different embodiments, the local network controllers may use different techniques to compute the routes for use by the SRs. Some embodiments perform all of the calculations on the local controller that manages the master routing protocol application, while in other embodiments each local controller performs separate calculations to determine the routing table for its local SR (also referred to as proxy installation).

FIG. 5 conceptually illustrates a process 500 of some embodiments for installing the routes calculated by the routing protocol application for use by the SRs, when the installation is performed by the local network controller operating at the gateway host with the master routing protocol application, to install routes both on its local MFE as well as the other MFEs that implement other SRs of the same logical router. This process 500 will be described in part by reference to FIGS. 6 and 7. FIG. 6 conceptually illustrates three SRs of a logical router and their connections to external routers, while FIG. 7 conceptually illustrates the individualization of routing tables for these SRs by a local controller 700.

As shown, the process 500 begins by receiving (at 505) a set of routes from the master routing protocol application, located locally on the host. This master routing protocol application receives the routes via routing protocol packets as described above, and calculates an overall routing table (FIB) for the logical router. This overall routing table is provided to the local controller.

As mentioned, FIG. 6 conceptually illustrates an example of three SRs 605-615 that operate as gateways for a logical router. In this case, the first SR 605 has two northbound interfaces, connected to external router 620 via subnet 10.1.1.0/24 and external router 625 via subnet 11.1.1.0/24. The second SR 610 also has two northbound interfaces, connected to external router 625 via subnet 11.1.1.0/24 and external router 630 via subnet 12.0.0.0/24. Lastly, the third SR 615 has only one northbound interface, which is also connected to the external router 630 via subnet 12.1.1.0/24.

FIG. 7 illustrates a routing table (FIB) 705 calculated by the master routing protocol application operating on the same gateway as one of the SRs 605-615. This routing table includes six routes (which is much smaller than would be expected in a typical deployment), which are learned based on routing protocol packets sent from the external routers 620-630 to the SRs 605-615. These include two routes (9.1.1.0/28 and 128.4.4.0/26) with a next hop address of 10.1.1.13, two routes (192.0.0.0/30 and 192.0.0.0/24 with a next hop address of 11.1.1.9, and one route (132.5.5.0/24) with a next hop address of 12.1.1.3. The routing table also includes an ECMP route (191.0.0.0/28) with possible next hop addresses of 10.1.1.13 and 12.1.1.13.

Returning to FIG. 5, the process 500 uses the received routing table to compute a separate routing table for each SR. As shown, the process selects (at 510) one of the SRs of the logical router. While the process 500 illustrated in this figure iterates over the SRs of the logical router, it should be understood that this is a conceptual process. Other embodiments might iterate over each route in the routing table, or perform operations for multiple SRs or multiple routes in parallel.

The process 500 identifies (at 515) the subnets to which the selected SR connects. This information is known to the local controller as part of the logical network configuration data received by the local controller. Specifically, in some embodiments, each local controller knows the interfaces that are assigned to each SR, and the connectivity information for those interfaces. As such, the subnets for each SR are based on the aggregate connectivity of the interfaces for the SR. In the example of FIG. 6, the first SR 605 connects to subnets 10.1.1.0/24 and 11.1.1.0/24, the second SR 610 connects to subnets 11.1.1.0/24 and 12.1.1.0/24, and the third SR 615 connects to only the one subnet 12.1.1.0/24.

Next, the process identifies (at 520) the routes with next hops in the subnets of the selected SR, and generates (at 525) a routing table for the SR that includes these routes. That is, the local controller generates a routing table for each SR that includes only the routes with next hops that make sense for the SR. In some embodiments, when the received routing table includes ECMP routes with multiple next hops, only those next hops that are on subnets to which the SR has a connecting interface are included. With the routing table generated for the currently selected SR, the process determines (at 530) whether additional SRs remain for which the process needs to generate the routing table. If additional SRs remain, the process returns to 510 to select the next SR and generate its routing table as well.

FIG. 7 illustrates three output routing tables 710-720 for the SRs 605-615 respectively, as computed by the local controller 700. As shown, the routing table 710 for the first SR 605 includes both of the routes with next hop address 10.1.1.13 and both of the routes with next hop address 11.1.1.9. In addition, the controller 700 includes the route for 191.0.0.0/28 in this routing table, but with only a single next hop address 11.1.1.9. Because the next hop address 12.1.1.3 is not on either of the subnets of the SR 605, this second equal-cost option is not included in the routing table for that SR. The routing table 715 for the second SR 610 includes both of the routes with next hop address 11.1.1.9 and the route with next hop address 12.1.1.3. In addition, the route for 191.0.0.0/28 is also included, but with a next hop of 12.1.1.3 rather than 10.1.1.13. Lastly, the routing table 720 for the third SR 615 includes only two routes, the one route with a next hop address 12.1.1.3 and the ECMP route for 191.0.0.0/28, again using only the next hop address of 12.1.1.3. While in this example none of the routes in the individual routing tables for the SRs include ECMP routes, if the original routing table included a route with next hops 10.1.1.13 and 11.1.1.9, this route would be used with both possible next hops in the routing table for the first SR 605.

After generating all of the individual SR routing tables, the process 500 distributes (at 535) the routing tables to the local controllers for each SR. This includes using the routing table for the local SR to configure the MFE implementing that SR (or configuring the separate data compute node implementing the SR, if this is separate from the MFE's datapath). In addition, the routing table entries for each other SR are distributed (e.g., via a central controller) to the respective local controller that manages the other SR, so that these local controllers can configure their SRs with the respective routes. In addition, some embodiments provide the full routing table to the central controller so that it can use this to add routes to the DR routing table, which allows the MFEs implementing the DR to send packets to the appropriate SR (e.g., in the example, sending packets with a destination IP address of 9.1.1.5 to the first SR 605 based on the route for 9.1.1.0/28).

FIG. 8 conceptually illustrates a process 800 of some embodiments for installing the routes calculated by the routing protocol application for use by the SRs, when the installation is performed separately by each local network controller for the SR operating on its gateway host (as opposed to the above-described process 500, in which the local controller for the active application calculates the routing tables for all of the SRs). This process 800 will be described in part by reference to FIGS. 6 and 9. FIG. 6, described above, conceptually illustrates three SRs of a logical router and their connections to external routers, while FIG. 9 conceptually illustrates the individualization of routing tables for these SRs by three separate local controllers 905-915.

As shown, the process 800 begins by receiving (at 805) a set of routes computed by the master routing protocol application for a logical router, which may be located locally on the host or at a different host. This master routing protocol application receives the routes via routing protocol packets as described above, and calculates an overall routing table (FIB) for the logical router. The master routing protocol application provides the overall routing to its local controller, which subsequently distributes the routing table to the other local controllers for the other SRs.

As mentioned, FIG. 9 illustrates a routing table (FIB) 900 calculated by the master routing protocol application operating on the same gateway as one of the SRs 605-615 from FIG. 6. This routing table 900 has the same six routes as the routing table 705 of FIG. 7, but in this case the entire table is provided to each of the local controllers 905-915, which respectively manage the MFEs implementing SRL SR2, and SR3.

The process 800 then determines how each route should be installed in the routing table for its local SR. As shown, the process selects (at 805) one of the routes from the received routing table. While the process shown in this figure processes each route one after the next, it should be understood that some embodiments may perform this process on multiple routes in parallel, or in other manners.

The process then determines (at 815) whether the selected route has at least one next hop accessible through a local connection. As noted above, routes computed based on the update information from routing protocol packets sent by external routers will generally specify one or more next hop addresses (e.g., interfaces of the external routers), which may or may not be locally accessible for any given SR. For example, in FIG. 6, next hop addresses on the subnet 10.1.1.0/24 and 11.1.1.0/24 are locally accessible for the first SR 605, but next hop addresses on 12.1.1.0/24 are not locally accessible for this SR.

If the route has at least one locally accessible next hop, then the process 800 adds (at 820) the route to the SR with all of the locally connected next hops. Thus, an ECMP route that specifies multiple next hop addresses that are locally connected to the SR will have multiple next hops in that SR's routing table. However, if an SR is only locally connected to a subset of the next hop addresses, then only that subset will be listed as next hops for the route in the SR's routing table.

Examples of these types of routes are shown in the routing tables 920-930 generated by the local controllers 905-915, respectively, for their local SRs. For instance, the first local controller 905 identifies that five of the six routes have locally connected interfaces for its SR 605, and thus adds these routes to the routing table 920 with the external router interface IPs as next hops. For one of these (for 191.0.0.0/28), only one of the two addresses is accessible, so this route is added with the single next hop address 10.1.1.13. For the second SR 610, its local controller 910 adds four routes with external router IP addresses as next hops (with the ECMP route for 191.0.0.0/28 using the only locally accessible next hop address 12.1.1.3). Lastly, for the third SR 615, the local controller 915 adds only two routes with external router IP addresses as next hops.

On the other hand, if the route does not have at least one locally accessible next hop, then the process 800 adds (at 825) the route to the SR with a different next hop address. Specifically, for the next hop address(es), the process uses the southbound interface address(es) of all SRs that are locally connected to the next hop(s) of the received route. That is, the local controller configures its SR to forward packets for addresses specified by the route to one of the other SRs via a tunnel, so that the other SR can forward the packet to the external router. By reference to FIG. 1, the southbound SR interfaces are those interfaces that logically connect to the transit logical switch 125.

In the examples of FIG. 9, each of the routing tables 920-930 includes at least one such route. The local controller 905 determines that the next hop 12.1.1.3 is not locally connected by its SR 605, but SRs 610 and 615 are equally connected to this address. As such, the route for 132.5.5.0/24 is added to the routing table 920 as an ECMP route, with next hop addresses of SR2 and SR3 (used to represent the southbound interface IP addresses for these SRs). Similarly, the local controller 910 determines that the routes for 9.1.1.0/28 and 128.4.4.0/26 do not specify any locally connected next hops for the SR 610, but based on the connectivity of SR 605 (to subnet 10.1.1.0/24), these routes are added to the routing table with the southbound interface IP address for SR1 as a next hop. The local controller 915 performs similar computation for four of the routes in the routing table 900 for its SR 615. Two of these are added as ECMP routes listing the southbound interface addresses of both SRs 605 and 610 as next hops, while others only list the address for SR 605.

After adding the route to the routing table with the appropriate set of next hop addresses, the process 800 determines (at 830) whether additional routes remain. If additional routes require processing, the process returns to 810 to add the next route to the routing table. Once all routes are processed, the process configures (at 835) the local MFE datapath with the SR routing table. In some embodiments, this entails modifying the rules in the configuration database entries for the SR to reflect the new additions to the routing table. The process 800 then ends.

In certain cases, one or more of the SRs and/or the routing protocol applications may become inoperative for some amount of time. In general, when a SR fails (e.g., the MFE fails), the routing protocol application has failed as well (as it cannot send or receive packets). The MFEs of some embodiments use a protocol such as bidirectional forwarding detection (BFD) to ensure that tunnels are up between host machines (both between two gateway host machines and between a gateway host machine and a host machine that hosts user DCNs), and this protocol allows the MFEs to identify when one has gone down, in which case the MFE or an agent running the protocol notifies the local controller on that host machine. If connectivity fails between a gateway host and an external router, in some embodiments the BFD sessions with the other gateways sets a diagnostic code (e.g., concatenated path down) to indicate that this connectivity is lost. In some embodiments, if the master routing protocol application loses external connectivity, then one of the standby (inactive) applications takes over.

In some embodiments, the response to such SR failure differs between active-active (i.e., all of the SRs are active, although only the one routing protocol application is master) and active-standby (i.e., one of the SRs is active and the others are standby SRs, often used with stateful services) configurations.

In the active-active case, when the failure occurs on the node hosting the active routing protocol application, the other SRs continue forwarding data traffic as is. In addition, the southbound IP addresses of the failed SR (i.e., those facing the DR) are distributed to the other SRs. In some embodiments, the local controllers elect a new master routing protocol application based on a deterministic priority/ranking algorithm (so that they all select the same application instance). Because the local controllers (at least the controller for the failed MFE) have the full routing table, this information can be distributed to the newly selected active routing protocol application, so that it does not have to start from scratch. In addition, when the previous master routing protocol application regains operation, some embodiments do not switch back to the old master, instead keeping the newly elected master in charge of the routing protocol control plane. This is done to prevent a second, unnecessary failover. In the failover situation, some embodiments use graceful restart at time of failover so that the datapath functions while the control plane managed by the routing protocol application re-converges.

When the datapath (MFE) fails on a gateway host that does not have the master routing protocol application, this may impact both data traffics as well as the adjacencies/neighborships for which that SR is responsible for forwarding the routing protocol packets. If the SRs use BFD to maintain connection with the physical routers, then the BFD failover detection time will determine the speed with which the north-south traffic is redistributed across the remaining gateways. The northbound IP addresses (uplink IPs) of the failed SR are not moved to other SRs, as these stay down until the SR returns to operation.

In the active-standby case, some embodiments treat BGP and OSPF differently. For BGP, some embodiments use AS-path-prepend for routes advertised for the standby SR. In the route server model described herein, this requires matching the source IP of the standby SR. Some embodiments use a field in the BGP route map table to match this source.

For OSPF, some embodiments use a higher interface cost in the updates for the standby SR. For redistributing routes into OSPF, some embodiments make these routes of type 1 external link-state advertisement (LSA), rather than type 2. This is because in the case of type 1, the cost to reach the autonomous system boundary router (ASBR) is also considered, and thus the higher interface cost is useful. For this feature, some embodiments also use a field in the redistribution table to set the path type to “type 1”. One issue that can occur with OSPF in the route server mode described herein involves a split brain scenario. In this scenario, continuous route flaps and reconvergence could occur, with two routing protocol applications attempting to send information with the same router ID. However, the management plane or central controller can be added as a mediator in some embodiments to avoid being stuck in these split brain scenarios. The ranking/priority algorithm can be used in some embodiments to exit out of a split brain scenario.

Many of the above-described features and applications are implemented as software processes that are specified as a set of instructions recorded on a computer readable storage medium (also referred to as computer readable medium). When these instructions are executed by one or more processing unit(s) (e.g., one or more processors, cores of processors, or other processing units), they cause the processing unit(s) to perform the actions indicated in the instructions. Examples of computer readable media include, but are not limited to, CD-ROMs, flash drives, RAM chips, hard drives, EPROMs, etc. The computer readable media does not include carrier waves and electronic signals passing wirelessly or over wired connections.

In this specification, the term “software” is meant to include firmware residing in read-only memory or applications stored in magnetic storage, which can be read into memory for processing by a processor. Also, in some embodiments, multiple software inventions can be implemented as sub-parts of a larger program while remaining distinct software inventions. In some embodiments, multiple software inventions can also be implemented as separate programs. Finally, any combination of separate programs that together implement a software invention described here is within the scope of the invention. In some embodiments, the software programs, when installed to operate on one or more electronic systems, define one or more specific machine implementations that execute and perform the operations of the software programs.

FIG. 10 conceptually illustrates an electronic system 1000 with which some embodiments of the invention are implemented. The electronic system 1000 can be used to execute any of the control, virtualization, or operating system applications described above. The electronic system 1000 may be a computer (e.g., a desktop computer, personal computer, tablet computer, server computer, mainframe, a blade computer etc.), phone, PDA, or any other sort of electronic device. Such an electronic system includes various types of computer readable media and interfaces for various other types of computer readable media. Electronic system 1000 includes a bus 1005, processing unit(s) 1010, a system memory 1025, a read-only memory 1030, a permanent storage device 1035, input devices 1040, and output devices 1045.

The bus 1005 collectively represents all system, peripheral, and chipset buses that communicatively connect the numerous internal devices of the electronic system 1000. For instance, the bus 1005 communicatively connects the processing unit(s) 1010 with the read-only memory 1030, the system memory 1025, and the permanent storage device 1035.

From these various memory units, the processing unit(s) 1010 retrieve instructions to execute and data to process in order to execute the processes of the invention. The processing unit(s) may be a single processor or a multi-core processor in different embodiments.

The read-only-memory (ROM) 1030 stores static data and instructions that are needed by the processing unit(s) 1010 and other modules of the electronic system. The permanent storage device 1035, on the other hand, is a read-and-write memory device. This device is a non-volatile memory unit that stores instructions and data even when the electronic system 1000 is off. Some embodiments of the invention use a mass-storage device (such as a magnetic or optical disk and its corresponding disk drive) as the permanent storage device 1035.

Other embodiments use a removable storage device (such as a floppy disk, flash drive, etc.) as the permanent storage device. Like the permanent storage device 1035, the system memory 1025 is a read-and-write memory device. However, unlike storage device 1035, the system memory is a volatile read-and-write memory, such a random access memory. The system memory stores some of the instructions and data that the processor needs at runtime. In some embodiments, the invention's processes are stored in the system memory 1025, the permanent storage device 1035, and/or the read-only memory 1030. From these various memory units, the processing unit(s) 1010 retrieve instructions to execute and data to process in order to execute the processes of some embodiments.

The bus 1005 also connects to the input and output devices 1040 and 1045. The input devices enable the user to communicate information and select commands to the electronic system. The input devices 1040 include alphanumeric keyboards and pointing devices (also called “cursor control devices”). The output devices 1045 display images generated by the electronic system. The output devices include printers and display devices, such as cathode ray tubes (CRT) or liquid crystal displays (LCD). Some embodiments include devices such as a touchscreen that function as both input and output devices.

Finally, as shown in FIG. 10, bus 1005 also couples electronic system 1000 to a network 1065 through a network adapter (not shown). In this manner, the computer can be a part of a network of computers (such as a local area network (“LAN”), a wide area network (“WAN”), or an Intranet, or a network of networks, such as the Internet. Any or all components of electronic system 1000 may be used in conjunction with the invention.

Some embodiments include electronic components, such as microprocessors, storage and memory that store computer program instructions in a machine-readable or computer-readable medium (alternatively referred to as computer-readable storage media, machine-readable media, or machine-readable storage media). Some examples of such computer-readable media include RAM, ROM, read-only compact discs (CD-ROM), recordable compact discs (CD-R), rewritable compact discs (CD-RW), read-only digital versatile discs (e.g., DVD-ROM, dual-layer DVD-ROM), a variety of recordable/rewritable DVDs (e.g., DVD-RAM, DVD-RW, DVD+RW, etc.), flash memory (e.g., SD cards, mini-SD cards, micro-SD cards, etc.), magnetic and/or solid state hard drives, read-only and recordable Blu-Ray® discs, ultra density optical discs, any other optical or magnetic media, and floppy disks. The computer-readable media may store a computer program that is executable by at least one processing unit and includes sets of instructions for performing various operations. Examples of computer programs or computer code include machine code, such as is produced by a compiler, and files including higher-level code that are executed by a computer, an electronic component, or a microprocessor using an interpreter.

While the above discussion primarily refers to microprocessor or multi-core processors that execute software, some embodiments are performed by one or more integrated circuits, such as application specific integrated circuits (ASICs) or field programmable gate arrays (FPGAs). In some embodiments, such integrated circuits execute instructions that are stored on the circuit itself.

As used in this specification, the terms “computer”, “server”, “processor”, and “memory” all refer to electronic or other technological devices. These terms exclude people or groups of people. For the purposes of the specification, the terms display or displaying means displaying on an electronic device. As used in this specification, the terms “computer readable medium,” “computer readable media,” and “machine readable medium” are entirely restricted to tangible, physical objects that store information in a form that is readable by a computer. These terms exclude any wireless signals, wired download signals, and any other ephemeral signals.

This specification refers throughout to computational and network environments that include virtual machines (VMs). However, virtual machines are merely one example of data compute nodes (DCNs) or data compute end nodes, also referred to as addressable nodes. DCNs may include non-virtualized physical hosts, virtual machines, containers that run on top of a host operating system without the need for a hypervisor or separate operating system, and hypervisor kernel network interface modules.

VMs, in some embodiments, operate with their own guest operating systems on a host using resources of the host virtualized by virtualization software (e.g., a hypervisor, virtual machine monitor, etc.). The tenant (i.e., the owner of the VM) can choose which applications to operate on top of the guest operating system. Some containers, on the other hand, are constructs that run on top of a host operating system without the need for a hypervisor or separate guest operating system. In some embodiments, the host operating system uses name spaces to isolate the containers from each other and therefore provides operating-system level segregation of the different groups of applications that operate within different containers. This segregation is akin to the VM segregation that is offered in hypervisor-virtualized environments that virtualize system hardware, and thus can be viewed as a form of virtualization that isolates different groups of applications that operate in different containers. Such containers are more lightweight than VMs.

Hypervisor kernel network interface modules, in some embodiments, is a non-VM DCN that includes a network stack with a hypervisor kernel network interface and receive/transmit threads. One example of a hypervisor kernel network interface module is the vmknic module that is part of the ESXi™ hypervisor of VMware, Inc.

It should be understood that while the specification refers to VMs, the examples given could be any type of DCNs, including physical hosts, VMs, non-VM containers, and hypervisor kernel network interface modules. In fact, the example networks could include combinations of different types of DCNs in some embodiments.

While the invention has been described with reference to numerous specific details, one of ordinary skill in the art will recognize that the invention can be embodied in other specific forms without departing from the spirit of the invention. In addition, a number of the figures (including FIGS. 4 and 5) conceptually illustrate processes. The specific operations of these processes may not be performed in the exact order shown and described. The specific operations may not be performed in one continuous series of operations, and different specific operations may be performed in different embodiments. Furthermore, the process could be implemented using several sub-processes, or as part of a larger macro process. Thus, one of ordinary skill in the art would understand that the invention is not to be limited by the foregoing illustrative details, but rather is to be defined by the appended claims. 

1-20. (canceled)
 21. A host computer comprising: a set of processing units; and a set of non-transitory machine-readable media storing: a managed forwarding element that operates as a first centralized routing component of a plurality of centralized routing components of a logical router that operate on a plurality of host computers, the plurality of centralized routing components for connecting a logical network to one or more external networks; a routing protocol application that operates as a route server to implement a dynamic routing protocol for the plurality of centralized routing components of the logical router; and a network controller that receives a routing table from the routing protocol application, identifies routes in the routing table for each of the centralized routing components, and distributes the identified routes to the centralized routing components on the plurality of host computers.
 22. The host computer of claim 21, wherein the routing protocol application is a first routing protocol application, wherein at least one other routing protocol application executes on at least one other host computer on which another of the centralized routing components operates.
 23. The host computer of claim 22, wherein the first routing protocol application is a master routing protocol application that generates the routing table based on routing protocol messages received by the managed forwarding element and forwarded to the master routing protocol application, wherein the other routing protocol applications are standby routing protocol applications that do not generate routing tables for the centralized routing components.
 24. The host computer of claim 23, wherein when the master routing protocol application or managed forwarding element on the host computer fails, one of the standby routing protocol applications is elected to take over as the master routing protocol application.
 25. The host computer of claim 23, wherein the managed forwarding element is a first managed forwarding element and the host computer is a first host computer, wherein when a second managed forwarding element executing on a second host computer of the plurality of host computers as a second centralized routing component receives a routing protocol packet, the second managed forwarding element forwards the routing protocol packet to the first managed forwarding element on the first host computer.
 26. The host computer of claim 25, wherein the second managed forwarding element classifies the routing protocol packet for less urgent processing than data traffic received by the second managed forwarding element.
 27. The host computer of claim 21, wherein (i) the first centralized routing component connects to a first external subnet and not a second external subnet and (ii) a second centralized routing component in the plurality of centralized routing components connects to the second external subnet and not the first external subnet.
 28. The host computer of claim 27, wherein the network controller stores information indicating the subnets to which each of the centralized routing components connect.
 29. The host computer of claim 28, wherein the network controller identifies routes in the routing table for a particular one of the centralized routing components by identifying routes with next hops in the subnets to which the particular centralized routing component connects.
 30. The host computer of claim 29, wherein routes with next hops in subnets to which the first centralized routing component does not connect are not sent to the first centralized routing component.
 31. A non-transitory machine-readable medium storing a datapath program which when executed by at least one processing unit of a first host computer implements a centralized routing component of a logical router of a logical network, the datapath program comprising sets of instructions for: receiving a routing protocol packet for the logical router from a router external to the logical network; when a master routing protocol application for the logical router executes on a second host computer on which a second centralized routing component of the logical router is implemented, encapsulating the routing protocol packet and transmitting the encapsulated packet to the second host computer; and when the master routing protocol application for the logical router executes on the first host computer, sending the routing protocol packet to the master routing protocol application executing on the first host computer.
 32. The non-transitory machine-readable medium of claim 31, wherein routing protocol applications execute on both the first and second host computers and only one of the routing protocol applications is elected as the master routing protocol application.
 33. The non-transitory machine-readable medium of claim 31, wherein the datapath program further comprises sets of instructions for: receiving a data packet from the router external to the logical network; and routing the data packet based on a routing table of the centralized routing component.
 34. The non-transitory machine-readable medium of claim 33, wherein the datapath program further comprises a set of instructions for processing the data packet according to additional logical forwarding elements of the logical network implemented by the datapath program.
 35. The non-transitory machine-readable medium of claim 34, wherein the additional logical forwarding elements comprises at least a logical switch and a distributed routing component of the logical router.
 36. The non-transitory machine-readable medium of claim 35, wherein the logical switch and the distributed routing component are also implemented by a second datapath program executing on the second host computer.
 37. The non-transitory machine-readable medium of claim 31, wherein the set of instructions for encapsulating the routing protocol packet comprises a set of instructions for adding a tunnel header that includes context information indicating that the encapsulated packet is a routing protocol packet.
 38. The non-transitory machine-readable medium of claim 37, wherein a second datapath program on the second host computer that implements the second centralized routing component uses the context information to send the routing protocol packet to the master routing protocol application on the second host computer.
 39. The non-transitory machine-readable medium of claim 31, wherein the set of instructions for sending the routing protocol packet to the master routing protocol application executing on the first host computer comprises a set of instructions for sending the routing protocol packet to a user-kernel transport associated with the first centralized routing component.
 40. The non-transitory machine-readable medium of claim 39, wherein the datapath program and the routing protocol application both execute in a userspace of virtualization software of the host computer, wherein the routing protocol packet is sent to a kernel of the virtualization software between the datapath program and the routing protocol application. 